	<include file='Common:header' />

		<!-- /section:basics/navbar.layout -->
		<div class="main-container" id="main-container">

			<!-- #section:basics/sidebar -->

	<include file='Common:left' />


			<!-- /section:basics/sidebar -->
			<div class="main-content">
				<div class="main-content-inner">
					<div class="page-content">

                        
                        
                        <!--主题-->
						<div class="page-header">
							<h1>
								您当前操作
								<small>
									<i class="ace-icon fa fa-angle-double-right"></i>
									添加文章
								</small>
							</h1>
						</div>


						<div class="row">
							<div class="col-xs-12">
								<form class="form-horizontal" name="form0" id="form0"  method="post" action="{:U('news_runadd')}"  enctype="multipart/form-data">
														
                                	<div class="form-group">
										<label class="col-sm-2 control-label no-padding-right" for="form-field-1"> 文章所属主栏目： </label>
										<div class="col-sm-10">
                                        <select name="news_columnid"  class="col-sm-3 selector">
                                        <option value="">请选择所属栏目</option>
                                        <foreach name="column" item="vo">
                                        <option value="{$vo.c_id}" <if condition="$vo.column_type eq 2">disabled class="bgccc"<else/>class="bgc"</if>>{$vo.lefthtml}{$vo.column_name} <if condition="$vo.column_type eq 2">(频道页)</if></option>
                                        </foreach>
                                        </select>
                                        </div>
									</div>
									<div class="space-4"></div>
                                    
                                	<div class="form-group">
										<label class="col-sm-2 control-label no-padding-right" for="form-field-1"> 文章名称：  </label>
										<div class="col-sm-10">
											<input type="text" name="news_title" id="news_title"  placeholder="必填：文章标题"  class="col-xs-10 col-sm-6"/>
											 <input type="text" name="news_titleshort" id="news_titleshort"  placeholder="简短标题，建议6~12字数"  class="col-xs-10 col-sm-4" style="margin-left:10px;" />
                                            <span class="help-inline col-xs-12 col-sm-7">
												<span class="middle" id="resone"></span>
											</span>
										</div>
									</div>
                                    <div class="space-4"></div>

									<div class="form-group">
										<label class="col-sm-2 control-label no-padding-right" for="form-field-1"> 文章属性：  </label>
												<div class="checkbox">
                                                <foreach name='diyflag' item='diyflag'>
													<label id="news_flag_{$diyflag.diyflag_value}">
														<input class="ace ace-checkbox-2" name="news_flag[]" type="checkbox" id="news_flag_va{$diyflag.diyflag_value}" value="{$diyflag.diyflag_value}" />
														<span class="lbl"> {$diyflag.diyflag_name}</span>
													</label>
                                                </foreach>
												</div>
									</div>
                                    <div class="space-4"></div>
									
									<div class="form-group" id="pptaddress">
										<label class="col-sm-2 control-label no-padding-right" for="form-field-1"> 跳转地址：  </label>
										<div class="col-sm-10">
											<input type="text" name="news_zaddress" id="news_zaddress" placeholder="跳转地址" class="col-xs-10 col-sm-7" />
                                            <span class="help-inline col-xs-12 col-sm-5">
												<span class="middle">正确格式：http:// 开头</span>
											</span>
										</div>
									</div>
                                    <div class="space-4"></div>
																		
									<div class="form-group">
										<label class="col-sm-2 control-label no-padding-right" for="form-field-1"> 文章关键字：  </label>
										<div class="col-sm-10">
											<input type="text" name="news_key" id="news_key" placeholder="输入文章关键字，以英文,逗号隔开" class="col-xs-10 col-sm-6" />
										</div>
									</div>
                                    <div class="space-4"></div>
									
									<div class="form-group">
										<label class="col-sm-2 control-label no-padding-right" for="form-field-1"> 文章来源：  </label>
										<div class="col-sm-10">
											<input type="text" name="news_source" id="news_source" value="本站原创" class="col-xs-10 col-sm-2" />
											<label class="input_last">
											常用：
											<volist name="source" id="k">
											<a class="btn btn-minier btn-yellow" href="javascript:;" onclick="return souadd('{$k.source_name}');" >{$k.source_name}</a>&nbsp;
											</volist>
											</label>
										</div>
									</div>
                                    <div class="space-4"></div>


									
									<div class="form-group">
										<label class="col-sm-2 control-label no-padding-right" for="form-field-1"> 封面图片上传： </label>
										<div class="col-sm-10">
										<a href="javascript:;" class="file">
                                          <input type="file" name="pic_one[]" id="file0" />
											选择上传文件
										</a>
											<span class="lbl">&nbsp;&nbsp;<img src="__PUBLIC__/img/no_img.jpg" width="100" height="70" id="img0" ></span>&nbsp;&nbsp;<a href="javascript:;" onClick="return backpic('__PUBLIC__/img/no_img.jpg');" title="还原修改前的图片" class="file">
                                            撤销上传
										</a>
											<span class="lbl">&nbsp;&nbsp;上传前先用PS处理成等比例图片后上传，默认比例100*70、600*420、800*560像素<br />
</span>
										</div>
									</div>
                                    <div class="space-4"></div>


									<div class="form-group">
										<label class="col-sm-2 control-label no-padding-right" for="form-field-1"> 文章显示模式： </label>
										<div class="col-sm-10">
                                            <div class="radio" >
													<label>
														<input name="news_pic_type" id="news_pic_list" checked type="radio" class="ace" value="1"/>
														<span class="lbl"> 普通模式</span>
													</label>
													<label>
														<input name="news_pic_type" id="news_pic_qqlist" type="radio" class="ace" value="2"/>
														<span class="lbl"> 多图模式</span>
													</label>
												</div>
										</div>
									</div>
                                    <div class="space-4"></div>






    <link href="__PUBLIC__/ppy/css/fileinput.css" media="all" rel="stylesheet" type="text/css" />	
    <script src="__PUBLIC__/ppy/js/fileinput.js" type="text/javascript"></script>
    <script src="__PUBLIC__/ppy/js/fileinput_locale_zh.js" type="text/javascript"></script>



									<div class="form-group" id="pic_list">
										<div class="col-sm-12" style="padding-top:5px;">
                                          <input id="file-5" name="pic_all[]" type="file" class="file"  multiple data-preview-file-type="any" data-upload-url="#" data-preview-file-icon=""><br />
										  <textarea name="news_pic_content" class="col-xs-12 col-sm-12" id="news_pic_content"  placeholder="多图对应文章说明，例如： 图片一说明 | 图片二说明 | 图片三说明    每个文字说明以 | 分割" ></textarea>
										</div>
									</div>
                                    <div class="space-4"></div>


									<div class="form-group">
										<label class="col-sm-2 control-label no-padding-right" for="form-field-1"> 是否审核： </label>
										<div class="col-sm-10" style="padding-top:5px;">
                                            <input name="news_open" id="news_open" value="1" class="ace ace-switch ace-switch-4 btn-flat" type="checkbox" />
											<span class="lbl">&nbsp;&nbsp;默认关闭</span>
										</div>
									</div>
                                    <div class="space-4"></div>

									<div class="form-group">
										<label class="col-sm-2 control-label no-padding-right" for="form-field-1"> 文章简介： </label>
										<div class="col-sm-9">
											<input type="text" name="news_scontent" id="news_scontent" class="col-xs-10 col-sm-10"  maxlength="50" />
											<label class="input_last">已限制在50个字以内</label>
										</div>
									</div>
                                    <div class="space-4"></div>

									<div class="form-group">
										<label class="col-sm-2 control-label no-padding-right" for="form-field-1"> 文章主内容 </label>
										<div class="col-sm-10">
											<script src="__PUBLIC__/ueditor/ueditor.config.js" type="text/javascript"></script>
                                            <script src="__PUBLIC__/ueditor/ueditor.all.js" type="text/javascript"></script>
											<textarea name="news_content" rows="100%" style="width:100%" id="myEditor"></textarea>  
											<script type="text/javascript"> 
                                                var editor = new UE.ui.Editor(); 
                                                editor.render("myEditor"); 
                                            </script>
										</div>
									</div>
                                    <div class="space-4"></div>
                                    
									<div class="clearfix form-actions">
										<div class="col-md-offset-3 col-md-9">
											<button class="btn btn-info" type="submit">
												<i class="ace-icon fa fa-check bigger-110"></i>
												保存
											</button>

											&nbsp; &nbsp; &nbsp;
											<button class="btn" type="reset">
												<i class="ace-icon fa fa-undo bigger-110"></i>
												重置
											</button>
										</div>
									</div>
								</form>
                        	</div>
                        </div>
									<div class="hr hr-24"></div>

<include file='Common:header_nav' />

					</div><!-- /.page-content -->
				</div>
			</div><!-- /.main-content -->

	<include file='Common:footer' />

		</div><!-- /.main-container -->

	</body>
</html>
<script>
function backpic(picurl){
	$("#img0").attr("src",picurl);//还原修改前的图片
	$("input[name='file0']").val("");//清空文本框的值
}

$(document).ready(function(){

//多图设置
  $("#pic_list").hide();
  $("#news_pic_list").click(function(){
  	$("#pic_list").hide();
  });
  $("#news_pic_qqlist").click(function(){
  	$("#pic_list").show();
  });
  
  $("#pptaddress").hide();
  $("#news_flag_vaj").click(function(){
    $("#pptaddress").toggle(500);
  });
});


$(function(){
	$('#form0').ajaxForm({
		beforeSubmit: checkForm, // 此方法主要是提交前执行的方法，根据需要设置
		success: complete, // 这是提交后的方法
		dataType: 'json'
	});
	
	function checkForm(){
		if( '' == $(".selector").val()){
			layer.alert('文章所属栏目不能为空', {icon: 6}, function(index){
 			layer.close(index);
			$('.selector').focus(); 
			});
			return false;
		}
	
		if( '' == $.trim($('#news_title').val())){
			layer.alert('文章标题不能为空', {icon: 6}, function(index){
 			layer.close(index);
			$('#news_title').focus(); 
			});
			return false;
		}
 }
	function complete(data){
		if(data.status==1){
			layer.alert(data.info, {icon: 6}, function(index){
 			layer.close(index);
			window.location.href=data.url;
			});
		}else{
			layer.alert(data.info, {icon: 6}, function(index){
 			layer.close(index);
			window.location.href=data.url;
			});
		}
	}
 
});

$("#file0").change(function(){
	var objUrl = getObjectURL(this.files[0]) ;
	console.log("objUrl = "+objUrl) ;
	if (objUrl) {
		$("#img0").attr("src", objUrl) ;
	}
}) ;
//建立一個可存取到該file的url
function getObjectURL(file) {
	var url = null ; 
	if (window.createObjectURL!=undefined) { // basic
	$("#news_flag_vap").attr("checked", true);
		url = window.createObjectURL(file) ;
	} else if (window.URL!=undefined) { // mozilla(firefox)
	$("#news_flag_vap").attr("checked", true);
		url = window.URL.createObjectURL(file) ;
	} else if (window.webkitURL!=undefined) { // webkit or chrome
		$("#news_flag_vap").attr("checked", true);
		url = window.webkitURL.createObjectURL(file) ;
	}
	return url ;
}
//来源
function souadd(val){
	$('#news_source').val(val);
}

</script>
